{include file="public/layout" /}
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 
<span class="c-gray en">&gt;</span> 系统管理
<span class="c-gray en">&gt;</span> 添加广告
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i>
</a>
</nav>
<article class="page-container">
  <form action="{:U('Ad/adHandle')}" method="post" class="form form-horizontal" id="form-handle">
    <div class="row cl" style="margin-top: 50px;">
       <div>
      <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>广告名称：</label>
      <div class="formControls col-xs-8 col-sm-9">
      <input style="width: 50%;" class="input-text" type="text" name="ad_name" id="ad_name" maxlength="200" value="{$info.ad_name ? $info.ad_name : ''}">
      </div>
      </div>
    </div>
    <div class="row cl">
       <div>
      <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>广告链接：</label>
      <div class="formControls col-xs-8 col-sm-9">
      <dd class="opt">
            <input type="text" name="ad_link" class="input-text" value="{$info.ad_link ? $info.ad_link : ''}" style="width: 50%;">
      </div>
      </div>
    </div>
    <div class="row cl">
       <div>
      <label class="form-label col-xs-4 col-sm-2">广告位置：</label>
      <div class="formControls col-xs-8 col-sm-9">
      <dd class="opt">
            <select class="input-text" name="pid" style="width: 50%;">
              {if $position}
              {foreach name="position" item="vo" key="k" }
              <option value="{$vo.position_id}" {if isset($info.pid) && $info.pid == $vo.position_id} selected="selected" {/if}>{$vo.position_name}</option>
              {/foreach}
              {/if}
            </select>
      </div>
      </div>
    </div>
    <div class="row cl">
       <div>
      <label class="form-label col-xs-4 col-sm-2">广告图片：</label>
      <div class="formControls col-xs-8 col-sm-9">
      <dd class="opt">
            <input type="text" class="input-text" name="ad_code" id="ad_code" style="width: 50%;" value="{$info.ad_code ? $info.ad_code : ''}">
            <input class="btn btn-success radius" type="button" value="上传图片" onClick="GetUploadify(1,'','ad_code','img_call_back')">
          </dd>
      </div>
      </div>
    </div>
    <div class="row cl">
       <div>
      <label class="form-label col-xs-4 col-sm-2">是否显示：</label>
      <div class="formControls col-xs-8 col-sm-9">
      <dd class="opt">
            <input type="radio" class="t_mane" name="enabled" id="enabled" value="1" {if isset($info.enabled) && $info.enabled == 1} checked="checked" {/if}>是
            <input type="radio" class="t_mane" name="enabled" id="enabled" value="0" {if isset($info.enabled) && $info.enabled == 0} checked="checked" {/if}>否
          </dd>
      </div>
      </div>
    </div>
    <div class="row cl">
       <div>
      <label class="form-label col-xs-4 col-sm-2">排序：</label>
      <div class="formControls col-xs-8 col-sm-9">
      <input style="width: 50%;" class="input-text" type="text" name="orderby" maxlength="200" value="{$info.orderby ?  $info.orderby : '100'}">
      </div>
      </div>
    </div>
    <div class="row cl">
      <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
        <input type="hidden" name="ad_id" value="{$info.ad_id ?  $info.ad_id : ''}">
        <a href="JavaScript:void(0);" onclick="adsubmit();" class="btn btn-primary" id="submitBtn">确认提交</a>&nbsp;&nbsp;
        <a href="JavaScript:void(0);" onclick="javascript:history.go(-1);" class="btn btn-success" id="submitBtn">返回上一页</a>
      </div>
    </div>
  </form>
</article>
{include file="public/footer" /}
<script type="text/javascript">
    function img_call_back(fileurl_tmp)
    {
      $("#ad_code").val(fileurl_tmp);
    }

    function adsubmit(){
      if($('#ad_name').val() == ''){
        layer.msg('广告名称不能为空！', {icon: 2,time: 1000});
        return false;
      }

      if($('#ad_link').val == 0){
        layer.msg('权限码不能为空！', {icon: 2,time: 1000});
        return false;
      }
      $('#form-handle').submit();
    }
</script>
</body>
</html>